﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Windows="clr-namespace:MixModes.Synergy.Web.VisualFramework.Windows"
                    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
                    xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:Triggers="clr-namespace:MixModes.Synergy.Web.VisualFramework.Triggers">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/MixModes.Synergy.Web.VisualFramework;component/Themes/Brushes.xaml" />
        <ResourceDictionary Source="/MixModes.Synergy.Web.VisualFramework;component/Themes/Buttons.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="TextBlock">
        <Setter Property="TextTrimming"
                Value="WordEllipsis" />
    </Style>

    <Style TargetType="Windows:DockPane">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Windows:DockPane">
                    <Grid>
                        <Controls:DockPanel>
                            <Border x:Name="PART_DOCK_PANE_HEADER"
                                    Controls:DockPanel.Dock="Top"
                                    BorderThickness="0"
                                    CornerRadius="2,2,0,0"
                                    Background="{TemplateBinding Background}">
                                <Controls:DockPanel>

                                    <Button x:Name="PART_CLOSE"
                                            Controls:DockPanel.Dock="Right"
                                            Style="{StaticResource DockPaneButton}"
                                            Margin="0,0,4,0"
                                            VerticalAlignment="Center">

                                        <Path Height="16"
                                              Width="16"
                                              Data="M4,4 L12,12 M12,4 L4,12"
                                              Stroke="{StaticResource DockPaneHeaderForegroundBrush}" />
                                    </Button>

                                    <ToggleButton x:Name="PART_PIN"
                                                  Controls:DockPanel.Dock="Right"
                                                  Style="{StaticResource DockPaneButton}"
                                                  Margin="0,0,4,0"
                                                  VerticalAlignment="Center"
                                                  RenderTransformOrigin="0.5,0.5">
                                        <ToggleButton.RenderTransform>
                                            <RotateTransform x:Name="PIN_ROTATE" />
                                        </ToggleButton.RenderTransform>
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup>
                                                <VisualState x:Name="Rotate">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="PIN_ROTATE"
                                                                         Storyboard.TargetProperty="Angle"
                                                                         From="0"
                                                                         To="90"
                                                                         Duration="0:0:0" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="UnRotate">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="PIN_ROTATE"
                                                                         Storyboard.TargetProperty="Angle"
                                                                         From="90"
                                                                         To="0"
                                                                         Duration="0:0:0" />
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Path Height="16"
                                              Width="16"
                                              Data="M6,4 L10,4 10,10 6,10z M4,11 L12,11 M8,10 L8,14 M9,4 L9,10"
                                              Stroke="{StaticResource DockPaneHeaderForegroundBrush}" />
                                        <Interactivity:Interaction.Triggers>
                                            <Interactivity:EventTrigger EventName="Checked">
                                                <Triggers:EventToVisualStateTrigger VisualState="{Binding ElementName=Rotate}" />
                                            </Interactivity:EventTrigger>
                                            <Interactivity:EventTrigger EventName="Unchecked">
                                                <Triggers:EventToVisualStateTrigger VisualState="{Binding ElementName=UnRotate}" />
                                            </Interactivity:EventTrigger>
                                        </Interactivity:Interaction.Triggers>
                                    </ToggleButton>

                                    <Button x:Name="PART_DOCK_PANE_MENU"
                                            Controls:DockPanel.Dock="Right"
                                            Style="{StaticResource DockPaneButton}"
                                            Margin="0,0,4,0"
                                            VerticalAlignment="Center">

                                        <Path Fill="{StaticResource DockPaneHeaderForegroundBrush}"
                                              Height="16"
                                              Width="16"
                                              Data="M4,6 L12,6 8,10 z" />
                                    </Button>

                                    <ContentControl Margin="4"
                                                    VerticalAlignment="Center"
                                                    Content="{TemplateBinding Header}"
                                                    Foreground="{StaticResource DockPaneHeaderForegroundBrush}">
                                        <ContentControl.Resources>
                                        </ContentControl.Resources>
                                    </ContentControl>
                                </Controls:DockPanel>
                            </Border>
                            <Border BorderThickness="1"
                                    BorderBrush="{TemplateBinding BorderBrush}">
                                <ContentPresenter />
                            </Border>
                        </Controls:DockPanel>
                        <Grid x:Name="PART_ADORNER_LAYER" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Background"
                Value="{StaticResource DockPaneBorderBrush}" />
        <Setter Property="BorderBrush"
                Value="{StaticResource DockPaneBorderBrush}" />
        <Setter Property="CondencedDockPanelTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border CornerRadius="0,0,2,2"
                            Background="{StaticResource DockPaneBackgroundBrush}"
                            Margin="2">
                        <Controls:DockPanel>
                            <Image Source="{Binding Icon}"
                                   Margin="2,0,2,0"
                                   Controls:DockPanel.Dock="Left" />

                            <ContentControl Content="{Binding Header}"
                                            Margin="0,0,2,0"
                                            Foreground="{StaticResource DockPaneHeaderForegroundBrush}" />
                        </Controls:DockPanel>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>